package com.innovativethinking.web.di;

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;

import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.innovativethinking.domain.service.KanbanTweetService;
import com.innovativethinking.domain.service.KanbanTweetServiceImpl;

public class KanbanTweetServiceModule extends AbstractModule {

	@Override
	protected void configure() {
		bind(KanbanTweetService.class).to(KanbanTweetServiceImpl.class);
	}
	
	@Provides PersistenceManager pm(PersistenceManagerFactory pmf) {
		return pmf.getPersistenceManager(); 
	}
	
	@Provides @Singleton PersistenceManagerFactory pmf() {
		return JDOHelper.getPersistenceManagerFactory(("transactions-optional")); 
	}
	
	@Provides @Singleton UserService getUserService() {
		return UserServiceFactory.getUserService();
	}

}
